package com.lalilu.homework9.service;

import android.app.Service;
import android.content.Intent;
import android.os.Binder;
import android.os.IBinder;

import com.lalilu.homework9.MusicHelper;

public class MusicService2 extends Service {
    private final MusicHelper musicHelper;

    public MusicService2() {
        musicHelper = new MusicHelper(this);
    }

    public static class MyBinder extends Binder {
        private final MusicService2 service;

        public MyBinder(MusicService2 service) {
            this.service = service;
        }

        public void play() {
            service.musicHelper.play();
        }

        public void next() {
            service.musicHelper.next();
        }

        public void pause() {
            service.musicHelper.pause();
        }

        public void destroy() {
            service.musicHelper.destroy();
        }

    }

    @Override
    public IBinder onBind(Intent intent) {
        return new MyBinder(this);
    }
}